{% extends "bills/base.html" %}
{% block meta %} <meta http-equiv="refresh" content="300"> {% endblock %}
{% block css %}
 tr.bill td {
  cursor:pointer;
  padding-top: 0;
  padding-bottom: 0;
  white-space: nowrap;
 }
{% endblock %}
{% block body_main %}
<table border="0"> <tr>
{% if canadd %}
<td>
<a href="{% url 'bills.views.bill_add' %}"> {% include "button/new.html" %} </a>
</td>
{% endif %}
<td nowrap>
{% include "paginator.html" %}
</td>
<td nowrap>
 <label for="lpp">Строк:</label>
 <!--select onchange="document.location=this.options[this.selectedIndex].value"-->
 <select onchange="document.location=this.options[this.selectedIndex].value">
  <option value="{% url 'bills.views.bill_set_lpp' 10 %}" {% ifequal lpp 10 %}selected{% endifequal %}>10</option>
  <option value="{% url 'bills.views.bill_set_lpp' 15 %}" {% ifequal lpp 15 %}selected{% endifequal %}>15</option>
  <option value="{% url 'bills.views.bill_set_lpp' 20 %}" {% ifequal lpp 20 %}selected{% endifequal %}>20</option>
  <option value="{% url 'bills.views.bill_set_lpp' 25 %}" {% ifequal lpp 25 %}selected{% endifequal %}>25</option>
  <option value="{% url 'bills.views.bill_set_lpp' 50 %}" {% ifequal lpp 50 %}selected{% endifequal %}>50</option>
 </select>
</td>
<td nowrap> Открыть:
 {% ifequal mode 1 %}
  <a href="{% url 'bills.views.bill_set_mode' 2 %}"> <button type="button" class="rounded" title="Входящие"> Входящие </button> </a>
 {% else %}
  <a href="{% url 'bills.views.bill_set_mode' 1 %}"> <button type="button" class="rounded" title="Все"> Все </button> </a>
 {% endifequal %}
</td>
{% if fsform %}
<td nowrap>
<form action="{% url 'bills.views.bill_filter_state' %}" method="POST">
{% csrf_token %}
 {{ fsform.draft }} {{ fsform.draft.label }} |
 {{ fsform.onway }} {{ fsform.onway.label }} |
 {{ fsform.onpay }} {{ fsform.onpay.label }} |
 {{ fsform.done }} {{ fsform.done.label }} |
 {{ fsform.dead }} {{ fsform.dead.label }}
 {% include "button/filter.html" %}
</form>
</td>
{% endif %}
</tr> </table>
<table>
 <thead>
 <tr>
  <th/>
  <th> # </th>
  <th> Объект </th>
  <th> Подобъект </th>
  <th> Направление </th>
  <th> Поставщик </th>
  <th> Плательщик </th>
  <th title="К оплате"> К&nbsp;опл. </th>
  <th title="Исполнитель"> Исполн. </th>
  <th> Подписант </th>
  <th> ? </th>
 </tr>
 </thead>
 <tbody>
{% for object in object_list %}
 <tr class="bill" bgcolor="{{object.get_state_color}}"
 {% if object.rpoint %}
  {% ifequal object.rpoint.approve.pk user.pk %}
   style="font-weight:bold"
  {% else %}
   {% ifequal object.rpoint.role role %}
    style="font-weight:bold"
   {% endifequal %}
  {% endifequal %}
 {% endif %}
onclick="window.document.location='{% url 'bills.views.bill_view' object.pk %}'">
  <td> <img src="{{ STATIC_URL }}img/32/{{ object.state.get_icon }}" width="16px" height="16px" title="{{ object.get_state_name }}"/> </td>
  <td> {{ object.pk }} </td>
  <td> {{ object.place }} </td>
  <td> {{ object.subject|default:"---" }} </td>
  <td> {% if object.depart %} {{ object.depart }} {% else %} --- {% endif %} </td>
  <td> {% if object.shipper %} {{ object.shipper }} {% else %} {{ object.supplier }} {% endif %} </td>
  <td> {{ object.payer|default:"---" }} </td>
  <td align="right"> {% if object.topaysum %} {{ object.topaysum|stringformat:"d" }} {% endif %} </td>
  <td> {{ object.assign.user.last_name }} </td>
  <td> {% if object.rpoint %} {{ object.rpoint.get_str }} {% else %} --- {% endif %} </td>
  <td> {% if object.locked %} &radic; {% else %} - {% endif %} </td>
 </tr>
{% endfor %}
</table>
{% endblock %}
